package com.woniu.service.impl;

import com.woniu.entity.User;
import com.woniu.mapper.UserMapper;
import com.woniu.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author xiaoqi
 * @time 2021/01/03 18:06:13
 */
@Service//被容器管理
@Transactional//添加事务管理
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserMapper mapper;
    @Override
    public void saveTwo(User user, User user2) {
        mapper.save(user);
//        System.out.println(8/0);
        mapper.save(user2);
    }
}
